package com.gaoyi.crm.adapter;

import android.content.Context;

import androidx.core.content.res.ResourcesCompat;

import com.gaoyi.crm.BR;
import com.gaoyi.crm.R;
import com.gaoyi.crm.adapter.base.BaseDtoAdapter;
import com.gaoyi.crm.adapter.base.BaseViewHolder;
import com.gaoyi.crm.databinding.RvPromotionBinding;
import com.gaoyi.crm.db.dto.PmnDto;

public class PromotionAdapter extends BaseDtoAdapter<RvPromotionBinding, PmnDto> {


    public PromotionAdapter(Context context) {
        super(context);
    }

    @Override
    protected void setBindingVariable(RvPromotionBinding binding) {
        binding.setVariable(BR.format, "yyyy/MM/dd");
    }

    @Override
    protected void onBindItem(RvPromotionBinding binding, PmnDto item, int position) {
        int color = (position + 1) % 2 == 0 ? R.color.color_pale_purple : R.color.color_pale_purple2;
        binding.llPro.setBackgroundColor(ResourcesCompat.getColor(mContext.getResources(), color, null));
    }

    @Override
    protected void onCreateView(RvPromotionBinding binding, BaseViewHolder holder) {

    }

    @Override
    protected int getLayoutResId() {
        return R.layout.rv_promotion;
    }
}
